<?php
/* 极简版页面框架 */
session_start();
define('MYLAB_WEB_PAGE_TO_ROOT', '../../');

function mylabPageStartup($checks = []) {
    if (in_array('authenticated', $checks)) {
        if (!isset($_SESSION['user'])) {
            header('Location: ' . MYLAB_WEB_PAGE_TO_ROOT . 'dvwa/pages/login.php');
            exit;
        }
    }
}

function mylabPageNewGrab() {
    return [
        'title'   => '',
        'body'    => '',
    ];
}

function mylabHtmlEcho($page) {
    echo <<<HTML
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>{$page['title']}</title>
    <style>
        body{font-family:Arial,Helvetica,sans-serif;font-size:14px}
        .body_padded{width:80%;margin:0 auto}
        .vulnerable_code_area{background:#f5f5f5;border:1px solid #ddd;padding:15px;margin:15px 0}
        input[type=text],input[type=password]{width:200px}
    </style>
</head>
<body>
<div class="body_padded">
{$page['body']}
</div>
</body>
</html>
HTML;
}